<?php
/*
 * 首页面控制器
 * @author:zhulin
 * 
 */
class IndexController extends BaseController
{
    public function run()
    { 
        $cache = UserProduct_Inquire::getInstance()->getCacheValue ( 'userproduct' );
        //print_r( $cache );
        if( isset ($_SESSION['UId'])){
           if( isset( $_COOKIE['userInquire'] ) ){
           $result = unserialize( $_COOKIE['userInquire'] );
           $recommend = Product_Detail::productCoommend( $result);  
            
            }
            elseif( isset( $cache ) ){
                echo "cache";
                
            }
            else{
                echo "default";
           $default = Product_Detail::getDefault();   
              }
        }
        else{
               if( isset( $_COOKIE['userInquire'] ) ){
               $result = unserialize( $_COOKIE['userInquire'] );
               $recommend = Product_Detail::productCoommend( $result);  
                
                 
                }
                else{
                    echo "默认";
               $default = Product_Detail::getDefault();   
                  }
           
        }
      
         include TPL_DIR . 'index.php'; 
    }
    
    /**
     * 用户登录
     * 
     */
    public function login(){
       
        include TPL_DIR . 'login.php';
        
    }
    public function  register(){
        include TPL_DIR . 'register.php';
        
    }
    
}